/**
 * WhiMAIcpp - C++ interface for the Whiskey Media API's.
 *  Copyright (C) 2010  Anders Bugge
 *
 *  Data created and powered by:
 *  Whiskey Media	http://www.whiskeymedia.com/
 *  Giant Bomb		http://www.giantbomb.com/
 *  Comic Vine		http://www.comicvine.com/
 */

#ifndef COMMON_H_
#define COMMON_H_

#include "json\elements.h"

// STL includes
#include <map.h>

namespace WM
{

/// An array
/**
 * Contains a json Array
 */
class Array
{
public:
	/**
	 * @param array Json array reference to create array from.
	 */
	Array( const json::Array& array );
	~Array();

	/**
	 * @return Size of the array.
	 */
	size_t Size() const; ///< Get the size of the array
	double asValue( unsigned int index, std::string item, bool* ok = 0 );
	std::string asString( unsigned int index, std::string item, bool* ok = 0 );
	Array* asArray( unsigned int index, std::string item, bool* ok = 0 );

private:
	json::UnknownElement* arrayElm; ///< The array

	std::map<std::string, Array*> arrays; ///< List of sub arrays
};

}; // VMA


#endif /* COMMON_H_ */
